﻿/*
 * 
 * User: Gavin Mead
 * Date: 11/25/2009
 * Time: 1:56 PM
 * 
 * 
 */

using System;
using NUnit.Framework;

using GraphLibrary;

namespace GraphLibraryTests
{
    [TestFixture]
    public class DirectedEdgeTests
    {
        [Test]
        [Description("Verifies that vertexId1 is set as the outbound vertex.")]
        public void OutboundVertexTest()
        {
            IVertexId id = new BaseVertexId();
            IVertexId id1 = new BaseVertexId();
            
            IDirectedEdge<int> e = new DirectedEdge<int>(id, id1);
            
            Assert.AreEqual(id, e.OutboundVertex);
             
        }
        
        [Test]
        [Description("Verifies that DirectedEdge constructor calls " +
                     "base and throws an exception with null IVertexIds.")]
        public void NullVertexIdsConstructorTest()
        {
            IVertexId id = new BaseVertexId();
            ArgumentNullException ex1 = Assert.Throws<ArgumentNullException>(delegate {
                                                                                 IDirectedEdge<int> e = new DirectedEdge<int>(null, null);
                                                                             });
        
            ArgumentNullException ex2 = Assert.Throws<ArgumentNullException>(delegate {
                                                                                 IDirectedEdge<int> e = new DirectedEdge<int>(id, null);
                                                                             });
            
            ArgumentNullException ex3 = Assert.Throws<ArgumentNullException>(delegate {
                                                                                 IDirectedEdge<int> e = new DirectedEdge<int>(null, id);
                                                                             });
            
            Assert.NotNull(ex1);
            Assert.NotNull(ex2);
            Assert.NotNull(ex3);
                
        }
        
                     
    }
}
